package com.itheima.countdownlatchdemo;

import java.util.concurrent.CountDownLatch;

public class Demo01 {

    public static void main(String[] args) throws InterruptedException {
        //创建一个计数闭锁
        CountDownLatch lock= new CountDownLatch(8);
        //整两个类 一个发令员  一些 是运动员
        SheShou sheShou = new SheShou(lock);
        Thread she = new Thread(sheShou);
        she.start();
        for (int i=0;i<8;i++) {
            YunDongYuan yunDongYuan = new YunDongYuan(lock);
            Thread yun = new Thread(yunDongYuan);
            yun.setName(i+"号运动员");
            yun.start();
        }

        System.out.println("-----------");
    }
}
